package com.ruoyi.glsims.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.glsims.service.CountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * IntelliJ IDEA
 * project: graduate-leaving-school-information-management-system
 *
 * @author shimi
 * @since 2023/9/11
 */
@RestController
@RequestMapping("/gradu_info/count")
public class CountController extends BaseController {

    @Autowired
    private CountService service;

    @PreAuthorize("@ss.hasAnyRoles('admin,teacher')")
    @RequestMapping("/getCharts")
    public AjaxResult getCharts() {
        return success(new HashMap<String,Object>() {{
            put("pie",service.renderPieVO());
            put("line",service.renderLineVO());
        }});
    }

}
